<!doctype html>
<meta charset="utf-8">
<title>WebSQL: FTS3 internal tables should not be exposed</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
'use strict';

async_test(testCase => {
  const database = openDatabase(
      'Fts3InternalTableAccessTest', '1.0',
      'Database for FTS3 internal table access test', 1024 * 1024);
  assert_not_equals(database, null, 'openDatabase should not fail');

  database.transaction(testCase.step_func(transaction => {
    transaction.executeSql(
        'DROP TABLE IF EXISTS main;', [], () => {},
        testCase.unreached_func('Table drop should not fail'));
    transaction.executeSql(
        'CREATE VIRTUAL TABLE main USING FTS3;', [], () => {},
        testCase.unreached_func('FTS3 table creation should not fail'));
    transaction.executeSql(
        "INSERT INTO main VALUES('aaaa');", [], () => {},
        testCase.unreached_func('FTS3 table insertion should not fail'));
    transaction.executeSql(
        "UPDATE main_segdir SET root=x'0000';", [],
        testCase.unreached_func('FTS3 internal table access should fail'),
        testCase.step_func_done());
  }));
}, 'WebSQL should not allow access to FTS3 internal tables');

</script>
